<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateInfoCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('info_category', function (Blueprint $table) {
            $table->increments('id')->comment('自增ID');
            $table->unsignedTinyInteger('type')->default('1')->comment('栏目类型，数据字典：1列表 2单页 3外链');
            $table->unsignedInteger('info_model_id')->default('0')->comment('模型，栏目类型为信息时展示选择，后期扩展，目前固定为信息模型的ID');
            $table->unsignedInteger('parent_id')->default('0')->comment('上级栏目');
            $table->string('name', 50)->default('')->comment('栏目名称');
            $table->string('enname', 100)->default('')->comment('栏目英文名称');
            $table->string('icon', 50)->default('')->comment('栏目图标');
            $table->unsignedInteger('cover_image')->default('0')->comment('封面图，附件表ID');
            $table->string('keywords', 500)->default('')->comment('关键词，多个英文逗号隔开');
            $table->string('description', 200)->default('')->comment('栏目介绍');
            $table->string('href', 100)->default('')->comment('链接地址');
            $table->string('href_target', 10)->default('_self')->comment('打开方式，数据字典');
            $table->string('rel', 20)->default('')->comment('链接关系XFN');
            $table->unsignedInteger('sort')->default('999')->comment('排序位置');
            $table->unsignedTinyInteger('status')->default('1')->comment('发布状态');
            $table->unsignedInteger('created_user_id')->default('0')->comment('管理员ID');
            $table->string('index_template', 20)->default('category')->comment('栏目首页模板');
            $table->string('list_template', 20)->default('list')->comment('栏目列表页模板');
            $table->string('article_template', 20)->default('article')->comment('内容页模板');
            $table->timestamp('created_at')->nullable()->comment('创建时间');
            $table->timestamp('updated_at')->nullable()->comment('更新时间');
            $table->softDeletes()->comment('删除时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('info_category');
    }
}
